<?php
$id = $_GET['id'];
include_once 'paradigmShift/libraryIndex.php';
$row = getRoleDateByID($id);

$employees = getAllEmployees();

$dates = getAllDates();

$roles = getAllRoles();
?>
<form action="modifyShift.php" method="post">
    <input type="hidden" name='fieldToModify' value="Status">
    <input type="hidden" name='roleID' value="<?php echo $row['roleID'];?>">
    Status: <input type="text" name='newValue' value="<?php echo $row['shiftStatus'];?>">
    <input type='submit' value="Update">
</form>
<form action="modifyShift.php" method="post">
    <input type="hidden" name='fieldToModify' value="Employee">
    <input type="hidden" name='roleID' value="<?php echo $row['roleID'];?>">
    Employee:
    <?php
        echo '<select>';
        //while ($r = mysql_fetch_array($employees)) {
        foreach ($employees as $r) {
            echo '<option name="newValue" ';
            if($row['empID'] === $r['empID'])
            {
                echo 'selected';
            }
            echo ' value="'.$r["empID"].'" >';
            echo $r['empFname'].' '.$r['empLname'];
            echo '</option>';
        }
        echo '</select>';
    ?>
    <input type='submit' value="Update">
</form>
<form action="modifyShift.php" method="post">
    <input type="hidden" name='fieldToModify' value="StartTime">
    <input type="hidden" name='roleID' value="<?php echo $row['roleID'];?>">
    Start Time: 
    <?php
        echo '<select>';
        //while ($r = mysql_fetch_array($date)) {
        foreach ($date as $r) {
            echo '<option name="newValue" ';
            if($row['startTime'] === $r['dateId'])
            {
                echo 'selected';
            }
            echo ' value="'.$r["dateId"].'" >';
            echo $r['DATE'];
            echo '</option>';
        }
        echo '</select>';
    ?>
    <input type='submit' value="Update">
</form>
<form action="modifyShift.php" method="post">
    <input type="hidden" name='fieldToModify' value="EndTime">
    <input type="hidden" name='roleID' value="<?php echo $row['roleID'];?>">
    End Time:
    <?php
        echo '<select>';
        //while ($r = mysql_fetch_array($date)) {
        foreach ($date as $r) {
            echo '<option name="newValue" ';
            if($row['endTime'] === $r['dateId'])
            {
                echo 'selected';
            }
            echo ' value="'.$r["dateId"].'" >';
            echo $r['DATE'];
            echo '</option>';
        }
        echo '</select>';
    ?>
    <input type='submit' value="Update">
</form>
